<?php
declare(strict_types=1);
//采购盘点接口
namespace Modules\Takestock\Http\Controllers;

use Catch\Base\CatchController as Controller;
use Modules\Inventory\Repository\InventoryOrderRepository;use Modules\Takestock\Models\InventoryOrderDetailschedule;
use Illuminate\Http\Request;
use Modules\Takestock\Http\Repositories\TakestockReget;
use Catch\Exceptions\FailedException;


class TakestockController extends Controller
{
    public function __construct(
        protected readonly InventoryOrderDetailschedule $model
    ){}

    /**
     * @param Request $request
     * @return mixed
     */
    public function index(): mixed
    {
        return $this->model->getList();
    }

    /** PDA数量录入接口
     * @param Request $request
     * @return mixed
     */
    public function store(Request $request)
    {
        return TakestockReget::create($request->all());
        // return $this->model->storeBy($request->all());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function show($id)
    {
         return TakestockReget::Barcodename($code,$request->all());
        return $this->model->firstBy($id);
    }

    /*
    * @param Request $request
    * @param $id
    * @return mixed
    */
    public function update($id, Request $request)
    {
        return $this->model->updateBy($id, $request->all());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function destroy($id)
    {
        return $this->model->deleteBy($id);
    }

    /* 盘点PDA 扫码
     * @param $id
     * @return mixed
     */
    public function stockpda($code,Request $request)
    {
        return TakestockReget::Barcodename($code,$request->all());
    }

    /* 盘点单审核接口 扫码
     * @param $id
     * @return mixed
     */
    public function interface($id)
    {
        //return TakestockReget::checkPdaApi($id);
        return InventoryOrderRepository::inventoryOrderVerify($id);
    }


}


